<%@page import="Bean.ZipcodeBean"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
		String myContext = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<% request.setCharacterEncoding("utf-8"); %>
<jsp:useBean id="zdao" class="dao.ZipcodeDao"></jsp:useBean>
<%
	String area3 = request.getParameter("area3");
	ArrayList<ZipcodeBean> lists = zdao.getZipcodeList(area3);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript" src="./js/script.js"></script>
</head>
<body>
	<form action="ZipCheck.member" method="post" >
		<table border="1">
			<tr>
				<td colspan="2">동이름 입력 : <input type="text" name="area3">
				 <input type="submit" value="검색" >
				</td>
			</tr>
			<tr>
				<td align="center">우편번호</td>
				<td align="center">주소</td>
			</tr>
			<%
				if(lists == null || lists.size() == 0){
			%>
			<tr>
				<td colspan="2">
						검색하시고자 하는 주소 목록이 존재하지 않습니다.
				  </td>
			</tr>
			<% 
				}else{
						for(ZipcodeBean zipcode : lists){
							String address = zipcode.getArea1().trim() + " " + 
									zipcode.getArea2().trim() + " " + 
									zipcode.getArea3().trim() + " " + 
									zipcode.getArea4().trim() ; 
			%>
			<tr>				
				<td align="center">
					<a href="#" onclick="sendAddress('<%=zipcode.getZipcode() %>','<%=address%>')">
					<%=zipcode.getZipcode() %></a></td>
				<td align="left">
					<a href="#" onclick="sendAddress('<%=zipcode.getZipcode() %>','<%=address%>')"></a>
					<%=address%>
				</td>
			</tr>
			<%
						}
				}
			%>
		</table>
	</form>
</body>
</html>